import request from '@/utils/request'

/**
 * 查询企业的部门列表
 * @returns
 */
export const reqGetDepartments = () => request({
  method: 'GET',
  url: '/company/department'
})
/**
 * 根据部门ID删除部门
 * @param {*} id 部门id
 * @returns
 */
export const reqDelDepartments = (id) => request({
  method: 'DELETE',
  url: `/company/department/${id}`
})
/**
 * 新增部门
 * @param {*} data 表单组装数据 5个字段 注意有个pid
 * @returns
 */
export const reqAddDepartments = (data) => request({
  url: '/company/department',
  method: 'post',
  data
})
/**
 * 根据id查询部门详情
 * @param {*} id
 * @returns
 */
export const reqGetDepartDetail = (id) => request({
  url: `/company/department/${id}`,
  method: 'get'
})

/**
 * 根据id修改部门详情
 * @param {*} data 编辑的对象回显的数据对象
 * @returns
 */
export const reqUpdateDepartments = (data) => request(
  {
    url: `/company/department/${data.id}`,
    method: 'PUT',
    data
  }
)
